package cn.qingfeng.a003_chat_v2_1.server.session;

import io.netty.channel.Channel;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class Session {
    private static Map<String, Channel> usernameChannelMap = new ConcurrentHashMap<>();

    public static void bind(String username, Channel socketChannel) {
        usernameChannelMap.put(username, socketChannel);
    }

    public static void unbindByUsername(String username) {
        usernameChannelMap.remove(username);
    }

    public static Channel getChannel(String username) {
        return usernameChannelMap.get(username);
    }

}
